<%@ page import="com.infitecs.eyas.util.Dict" %>
<%@ page import="com.infitecs.eyas.security.model.User" %>
<%@ page import="java.util.List" %>
<%@ page import="com.infitecs.eyas.security.model.Role" %>
<%--@elvariable id="roleList" type="java.util.List<com.infitecs.eyas.security.model.Role>"--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<%
    User user = (User) session.getAttribute("user");
%>
<head>
    <%@include file="../includes/head.jsp" %>
    <title>${menu.menuName}</title>
    <link rel="stylesheet" type="text/css"
          href="<c:url value="/js/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css"/>"/>
    <link rel="stylesheet" type="text/css"
          href="<c:url value="/js/bower_components/ztree_v3/css/zTreeStyle/zTreeStyle.css"/>"/>
    <link rel="stylesheet" type="text/css" href="<c:url value="/css/global/ztree_custom.css"/>"/>
    <link rel="stylesheet" type="text/css" href="<c:url value="/js/bower_components/smalot-bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css"/>"/>
</head>
<body class="page-header-fixed page-quick-sidebar-over-content">
<%@include file="../includes/top.jsp" %>
<div class="page-container">
    <%@include file="../includes/sidebar.jsp" %>
    <div class="page-content-wrapper">
        <div class="page-content">
            <%@include file="../includes/current.jsp" %>
            <div class="row">
                <div class="col-md-12">
                    <div class="portlet">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="${menu.icon}"></i>${menu.menuName}
                            </div>
                            <div class="tools">
                                <a href="javascript:;" class="collapse"></a>
                            </div>
                            <div class="actions">
                                <a href="javascript:;" class="btn default yellow-stripe" id="addCase"><i
                                        class="fa fa-plus-square-o"></i><span class="hidden-480">新建方案</span></a>
                                <a href="javascript:;" class="btn default yellow-stripe" id="dataTableReload"><i
                                        class="fa fa-refresh"></i><span class="hidden-480"> <spring:message
                                        code="refresh"/></span></a>

                                <div class="btn-group">
                                    <a class="btn default yellow-stripe" href="#" data-toggle="dropdown">
                                        <i class="fa fa-list"></i>
                                        <span class="hidden-480"><spring:message code="columns"/></span>
                                        <i class="fa fa-angle-down"></i>
                                    </a>

                                    <div class="dropdown-menu hold-on-click dropdown-checkboxes pull-right"
                                         id="dataTableToggleColumn">
                                        <label><input type="checkbox" checked="checked" data-column="0">电厂名称</label>
                                        <label><input type="checkbox" checked="checked" data-column="1">方案名称</label>
                                        <label><input type="checkbox" checked="checked" data-column="2">创建时间</label>
                                        <label><input type="checkbox" checked="checked" data-column="3">创建人</label>
                                        <label><input type="checkbox" checked="checked" data-column="4"><spring:message
                                                code="actions"/></label>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="portlet-body">
                            <div class="table-container">
                                <table class="table table-striped table-bordered table-hover" id="dataTable">
                                    <thead>
                                    <tr role="row" class="heading">
                                        <th>电厂名称</th>
                                        <th>方案名称</th>
                                        <th>创建时间</th>
                                        <th>创建人</th>
                                        <th><spring:message
                                                code="actions"/></th>
                                    </tr>
                                    <tr role="row" class="filter">
                                        <td>
                                            <input type="text" class="form-control form-filter input-sm"
                                                    name="powerNameQuery"
                                                   id="powerNameQuery" placeholder="电厂名称">
                                        </td>
                                        <td>
                                            <input type="text" class="form-control form-filter input-sm"
                                                   name="caseNameQuery"
                                                   id="caseNameQuery" placeholder="电厂名称">
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                            <div class="margin-bottom-5">
                                                <a class="btn btn-sm yellow filter-submit margin-bottom">
                                                    <i class="fa fa-search"></i><spring:message code="query"/></a>
                                                <a class="btn btn-sm red filter-cancel">
                                                    <i class="fa fa-undo"></i><spring:message code="reset"/></a>
                                            </div>
                                        </td>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal fade bs-modal-lg" id="modalDialog" tabindex="-1" data-keyboard="false" aria-hidden="true"
     data-backdrop="static">
    <div class="modal-dialog modal-lg">
        <div class="modal-content" id="modalContent">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title" id="modalTitle"></h4>
            </div>
            <div class="modal-body form">
                <form id="dialogForm" class="form-horizontal">
                    <div class="form-body">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-md-4 control-label">电厂名称<span
                                            class="required"> * </span></label>

                                    <div class="col-md-6">
                                        <select id="power" class="form-control select2">
                                            <c:forEach items="${powers}" var="temp">
                                                <option value="${temp.powerId}" >${temp.powerName}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <div class="col-md-2">
                                        <a href="javascript:;" class="btn default yellow-stripe" id="addPower"><i
                                                class="fa fa-plus-square-o"></i><span class="hidden-480">新建电厂</span></a>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group last">
                                    <label class="col-md-4 control-label">方案名称<span
                                            class="required"> * </span></label>

                                    <div class="col-md-8">
                                        <input type="text" class="form-control input-medium"
                                               placeholder="方案名称"
                                               id="caseName" name="caseName" required="required">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-md-4 control-label">分享人员<span
                                            class="required"> * </span></label>
                                    <div class="col-md-6">
                                        <select id="users" class="form-control select2" multiple="multiple">
                                            <c:forEach items="${users}" var="temp">
                                                <option value="${temp.userId}">${temp.username}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn blue" id="addBtn"><spring:message code="save"/></button>
                <button type="button" class="btn default" data-dismiss="modal"><spring:message code="close"/></button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade bs-modal-lg" id="modalDialogPower" tabindex="1" data-keyboard="false" aria-hidden="true"
     data-backdrop="static">
    <div class="modal-dialog modal-lg">
        <div class="modal-content" id="modalContentPower">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title" id="modalTitlePower"></h4>
            </div>
            <div class="modal-body form">
                <form id="dialogFormPower" class="form-horizontal">
                    <div class="form-body">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label class="col-md-4 control-label">电厂名称<span
                                                class="required"> * </span></label>

                                        <div class="col-md-8">
                                            <input type="text" class="form-control input-medium"
                                                   placeholder="电厂名称"
                                                   id="powerName" name="caseName" required="required">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn blue" id="addPowerBtn"><spring:message code="save"/></button>
                <button type="button" class="btn default" data-dismiss="modal"><spring:message code="close"/></button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade bs-modal-lg" id="modalDialogShare" tabindex="1" data-keyboard="false" aria-hidden="true"
     data-backdrop="static">
    <div class="modal-dialog modal-lg">
        <div class="modal-content" id="modalContentShare">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title" id="modalTitleShare"></h4>
            </div>
            <div class="modal-body form">
                <form id="dialogFormShare" class="form-horizontal">
                    <div class="form-body">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label class="col-md-4 control-label">分享人员<span
                                            class="required"> * </span></label>
                                    <div class="col-md-6">
                                        <input type="hidden" id="caseId"/>
                                        <select id="usersShare" class="form-control select2" multiple="multiple">
                                            <c:forEach items="${users}" var="temp">
                                                <option value="${temp.userId}">${temp.username}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn blue" id="addShareBtn"><spring:message code="save"/></button>
                <button type="button" class="btn default" data-dismiss="modal"><spring:message code="close"/></button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade bs-modal-lg" id="modalDialogEdit" tabindex="-1" data-keyboard="false" aria-hidden="true"
     data-backdrop="static">
    <div class="modal-dialog modal-lg">
        <div class="modal-content" id="modalContentEdit">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title" id="modalEditTitle">方案编辑</h4>
            </div>
            <div class="modal-body form">
                <form id="dialogEditForm" class="form-horizontal">
                    <div class="form-body">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-md-4 control-label">电厂名称<span
                                            class="required"> * </span></label>

                                    <div class="col-md-6">
                                        <select id="powerEdit" class="form-control select2">
                                            <c:forEach items="${powers}" var="temp">
                                                <option value="${temp.powerId}" selected="selected">${temp.powerName}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <div class="col-md-2">
                                        <a href="javascript:;" class="btn default yellow-stripe" id="editPower"><i
                                                class="fa fa-plus-square-o"></i><span class="hidden-480">新建电厂</span></a>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group last">
                                    <label class="col-md-4 control-label">方案名称<span
                                            class="required"> * </span></label>

                                    <div class="col-md-8">
                                        <input type="text" class="form-control input-medium"
                                               placeholder="方案名称"
                                               id="caseEditName" name="caseEditName" required="required">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn blue" id="editBtn"><spring:message code="save"/></button>
                <button type="button" class="btn default" data-dismiss="modal"><spring:message code="close"/></button>
            </div>
        </div>
    </div>
    <input type="hidden" id="editCaseId" name="editCaseId">
</div>
<input type="hidden" id="userId" value="<%=user.getUserId()%>">
<input type="hidden" id="adminRole" value="<%=user.isAdmin()?"1":"0"%>">

<jsp:include page="../includes/confirmdiv.jsp"/>
<%@include file="../includes/footer.jsp" %>
<%@include file="../includes/bottomscript.jsp" %>
<script src="<c:url value="/js/bower_components/smalot-bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"/>"></script>
<script src="<c:url value="/js/bower_components/smalot-bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"/>"></script>
<script type="text/javascript"
        src="<c:url value="/js/bower_components/DataTables/media/js/jquery.dataTables.min.js"/>"></script>
<script type="text/javascript"
        src="<c:url value="/js/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js"/>"></script>
<script type="text/javascript"
        src="<c:url value="/js/bower_components/ztree_v3/js/jquery.ztree.core-3.5.min.js"/>"></script>
<script type="text/javascript"
        src="<c:url value="/js/bower_components/ztree_v3/js/jquery.ztree.excheck-3.5.min.js"/>"></script>
<script src="<c:url value="/js/global/scripts/datatable.js"/>"></script>
<script src="<c:url value="/js/quality/power.js"/>"></script>
<script type="text/javascript">
    $(function () {
        powerPage.init();
    });
</script>
</body>
</html>